babl_fish_reference(), create_name() are racy
authorRoman Lebedev <lebedev.ri@gmail.com>
Fri, 19 Aug 2016 18:01:03 +0000 (21:01 +0300)
committerØyvind Kolås <pippin@gimp.org>
Sat, 20 Aug 2016 17:26:00 +0000 (19:26 +0200)
commit0fe22e1e37197ef6112645bf5a136580c0927a1e
treea8c8d507f191bb93e0fc7f7dd03bf487a87f9a38
parent810263a19c30a7efb5cb795986f3e1424edc3c1b
babl_fish_reference(), create_name() are racy

create_name_internal() uses global static buffer to create name.
While this is definitely fast, it can't work concurrently.

I used snprintf()+malloc()+snprintf(), so the amount of allocated
memory for the string is optimal.

Alternatively, a mutex would solve the problem, not sure which
solution is faster / better.
babl/babl-fish-reference.c